/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trunk.TBBS.Java;

/**
 *
 * @author Thomas
 */
public class combatObject extends gameObject{
    //Hit points
    int HP, maxHP;
    
    //Mana points
    int MP, maxMP;
    
    //Constructors
    public combatObject(String n, String d, 
                        int hp, int mhp,
                        int mp, int mmp){
        super(n, d);
        HP = hp;
        maxHP = mhp;
        MP = mp;
        maxMP = mmp;
    }
    
    public combatObject(String n, String d){
        super(n, d);
        HP = 100;
        maxHP = 100;
        MP = 8;
        maxMP = 8;
    }
    
    //Affectors
    public boolean affectHP(int val){
        HP += val;
        if(HP > maxHP){
            HP = maxHP;
            return true;
        }else if(HP < 0){
            HP = 0;
            return false;
        }else{
            return true;
        }        
    }
    
    public boolean affectMP(int val){
        MP += val;
        if(MP > maxMP){
            MP = maxMP;
            return true;
        }else if(MP < 0){
            MP = 0;
            return false;
        }else{
            return true;
        }   
    }
    
    //Max Affectors
    public void affectMaxHP(int val){
        maxHP += val;
        if(maxHP < 1)
            maxHP = 1;        
    }
    
    public void affectMaxMP(int val){
        maxMP += val;
        if(maxMP < 1)
            maxMP = 1;        
    }
    
    //send functions
    
    public int getHP(){
        return HP;
    }
    public int getMaxHP(){
        return maxHP;
    }
    public int getMP(){
        return MP;
    }
    public int getMaxMP(){
        return maxMP;
    } 
    public void levelUpRestore(){
        HP = maxHP;
        MP = maxMP;
    }
}
